package com.example.JavaConcurrent.Project3_Phaser.bulkRegister;

import java.util.concurrent.Phaser;

public class Run {
    public static void main(String[] args) throws InterruptedException {
        Phaser phaser = new Phaser(7);
        phaser.bulkRegister(2);
        phaser.register();

        ThreadA[] th = new ThreadA[5];
        for (int i = 0; i <th.length ; i++) {
            th[i]=new ThreadA(phaser);
            th[i].setName("SS-"+i);
            th[i].start();
        }

        Thread.sleep(2000);
        System.out.println("h-"+phaser.getArrivedParties());
        System.out.println("u-"+phaser.getUnarrivedParties());

    }
}
